package com.cn.intelligence.resetful.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cn.intelligence.pojo.TaotaoResult;
import com.cn.intelligence.resetful.pojo.Conts;
import com.cn.intelligence.resetful.service.IndexService;
/**
 * 首页信息机接口
 * @author Administrator
 *
 */
@Controller
@RequestMapping("/Api/goods/")
public class IndexController {
	
	@Autowired
	public IndexService indexserice;
	
	/**
	 * 获取首页信息的brand图片 和产品初始信息
	 * @return
	 */
	@RequestMapping("list")
    @ResponseBody
	public TaotaoResult getIndexListOfProduct( String value, int sex,int gongneng,int guo,String pingpai, int nianlin1,
			int nianlin2, int qian1,int qian2){
		TaotaoResult taotaoresult = new TaotaoResult();
		taotaoresult.setMsg(Conts.SUCCESS_MSG);
		taotaoresult.setStatus(Conts.SUCCESS_CODE);
		taotaoresult.setData(indexserice.getIndexListOfProduct(value,sex,gongneng,guo,pingpai,nianlin1,nianlin2,qian1,qian2));
		return taotaoresult;
	}
	/**
	 * 获取首页信息的brand图片 和产品初始信息
	 * @return
	 */
	@RequestMapping("more")
    @ResponseBody
	public TaotaoResult getmoreProduct(String value,int page ,int sex,int gongneng,int guo,String pingpai,int nianlin1,
			int nianlin2,int qian1,int qian2){
		TaotaoResult taotaoresult = new TaotaoResult();
		taotaoresult.setMsg(Conts.SUCCESS_MSG);
		taotaoresult.setStatus(Conts.SUCCESS_CODE);
		taotaoresult.setData(indexserice.geMoreProducts(value,page,Conts.ROWS,sex,gongneng,guo,pingpai,nianlin1,nianlin2,qian1,qian2));
		return taotaoresult;
	}
	
	/**
	 * 获取首页信息的brand图片 和产品初始信息
	 * @return
	 */
	@RequestMapping("list2")
    @ResponseBody
	public TaotaoResult getIndexListOfProduct2(int show){
		TaotaoResult taotaoresult = new TaotaoResult();
		taotaoresult.setMsg(Conts.SUCCESS_MSG);
		taotaoresult.setStatus(Conts.SUCCESS_CODE);
		taotaoresult.setData(indexserice.getIndexListOfProduct2(show));
		return taotaoresult;
	}
	/**
	 * 获取首页信息的brand图片 和产品初始信息
	 * @return
	 */
	@RequestMapping("more2")
    @ResponseBody
	public TaotaoResult getmoreProduct2(int page ,int show){
		TaotaoResult taotaoresult = new TaotaoResult();
		taotaoresult.setMsg(Conts.SUCCESS_MSG);
		taotaoresult.setStatus(Conts.SUCCESS_CODE);
		taotaoresult.setData(indexserice.geMoreProducts2(page,Conts.ROWS,show));
		return taotaoresult;
	}
	
}
